# Contributor: Leon Marz <main@lmarz.org>
# Maintainer: Leon Marz <main@lmarz.org>
pkgname=openpgl
pkgver=0.5.0
pkgrel=0
pkgdesc="Intel Open Path Guiding Library"
url="https://openpgl.org"
arch="x86_64 aarch64" # only these are supported
license="Apache-2.0"
makedepends="
	cmake
	onetbb-dev
	samurai
	"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/OpenPathGuidingLibrary/openpgl/archive/v$pkgver.tar.gz"
options="!check" # no testsuite

build() {

	# fixes build on aarch64. see https://github.com/OpenPathGuidingLibrary/openpgl/issues/6
	export CXXFLAGS="$CXXFLAGS -flax-vector-conversions"

	CXXFLAGS="$CXXFLAGS -flto=auto" \
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=Release

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
9b992ffa17ad6f9fcde48add5d9cc1e58be2daacd40478fb1babe0741a6c7a64f12f36c9c1f7d5ec6f79cdd847c082d39e03e58cfd9af1a903adca56f1ac19e1  openpgl-0.5.0.tar.gz
"
